import React,{useEffect} from 'react'
import './LAR.scss'
import {Tabs,Badge} from "antd-mobile";
import MyNavBar from "../../components/NavBar/NavBar";
import Login from "./Login/Login";
import Reg from './Reg/Reg'
import {RouteComponentProps} from "react-router-dom";

const LAR = (props: RouteComponentProps) => {
    useEffect(() => {
        const uUid = sessionStorage.getItem('uUid')
        if(uUid){
            props.history.push('/in/chat')
        }
    },[])// eslint-disable-line react-hooks/exhaustive-deps
    const tabs = [
        { title: '登录' },
        { title: <Badge dot>注册</Badge> },
    ];
    return (
        <div className='LAR' style={{marginTop: '45px',marginBottom: '50px'}}>
            <MyNavBar content='登录与注册'/>
            <Tabs tabs={tabs}
                  initialPage={0}
            >
                <div style={{backgroundColor: '#fff',padding: '20px 0'}}>
                    <Login />
                </div>
                <div style={{backgroundColor: '#fff',padding: '20px 0'}}>
                    <Reg />
                </div>
            </Tabs>
        </div>
    )
}

export default LAR